package com.twu.biblioteca;

import com.twu.biblioteca.Models.*;

public class BibliotecaApp {

    public static void main(String[] args) {
        System.out.println("Welcome to TWU Biblioteca!");
        Menu startMenu = new Menu();
        BookLibrary bookLibrary = new BookLibrary();
        MovieLibrary movieLibrary = new MovieLibrary();
        UserList userList = new UserList();
        User loggedInUser = null;

        populateBookLibrary(bookLibrary);
        populateUserList(userList);
        populateMovieLibrary(movieLibrary);

        while (true) {
            startMenu.printSelectionMenu();
            startMenu.acceptMenuSelectionInputAndExecuteOption(bookLibrary, movieLibrary, userList, loggedInUser);
        }
    }

    private static void populateUserList(UserList userList) {
        User user = new User("111-1111", "def", "a@b.com", "986");
        userList.addUser(user);
        user = new User("111-1112", "def1", "a1@b.com", "9861");
        userList.addUser(user);
        user = new User("111-1113", "def2", "a2@b.com", "9862");
        userList.addUser(user);
    }

    private static void populateBookLibrary(BookLibrary bookLibrary) {
        BookLibrary.addTitleAsBookToLibrary(bookLibrary, "The Hobbit: Or there and back again");
        BookLibrary.addTitleAsBookToLibrary(bookLibrary, "Hitchhiker\'s Guide to the galaxy");
        BookLibrary.addTitleAsBookToLibrary(bookLibrary, "So long as thanks for all the Fish!");
    }

    private static void populateMovieLibrary(MovieLibrary movieLibrary) {
        MovieLibrary.addMovieToLibrary(movieLibrary, "The Hobbit", 2002, "Peter Jackson", (float)8.5);
        MovieLibrary.addMovieToLibrary(movieLibrary, "LOTR 1", 2001, "Peter Jackson", (float)9);
        MovieLibrary.addMovieToLibrary(movieLibrary, "LOTR 2", 2003, "Peter Jackson", (float)9.5);
        MovieLibrary.addMovieToLibrary(movieLibrary, "LOTR 3", 2004, "Peter Jackson", (float)8);
        MovieLibrary.addMovieToLibrary(movieLibrary, "The Ring", 2005, "ABC", (float)6.5);
        MovieLibrary.addMovieToLibrary(movieLibrary, "The Pianist", 2006, "Roman Polanski", (float)8.5);
        MovieLibrary.addMovieToLibrary(movieLibrary, "ABC", 2007, "Peter", (float)3.5);
        MovieLibrary.addMovieToLibrary(movieLibrary, "DEF", 2008, "Jackson", (float)0);
        MovieLibrary.addMovieToLibrary(movieLibrary, "GHI", 2009, "Peter Jaikisan", (float)4.5);
        MovieLibrary.addMovieToLibrary(movieLibrary, "JKL", 2010, "ASDF", (float)8.5);
        MovieLibrary.addMovieToLibrary(movieLibrary, "MNO", 2011, "Alan Wake", (float)8);
        MovieLibrary.addMovieToLibrary(movieLibrary, "PQR", 2012, "Arduino", (float)0);
        MovieLibrary.addMovieToLibrary(movieLibrary, "STU", 2013, "Raspberry", (float)8.5);
        MovieLibrary.addMovieToLibrary(movieLibrary, "VWX", 2014, "Pi", (float)6);
        MovieLibrary.addMovieToLibrary(movieLibrary, "YZ", 2015, "Peter Jackson", (float)5);
    }
}
